package com.webcams.ui.downloadmaps;

import android.app.TabActivity;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.widget.TabHost;
import android.widget.Toast;

import com.webcams.ui.R;

public class DownloadMapsUI extends TabActivity {

	@Override
	public void onCreate(Bundle state) {
		super.onCreate(state);

		setContentView(R.layout.download_maps);

		Resources res = getResources(); // Resource object to get Drawables
		TabHost tabHost = getTabHost();  // The activity TabHost
		TabHost.TabSpec spec;  // Resusable TabSpec for each tab
		Intent intent;  // Reusable Intent for each tab

		// Create an Intent to launch an Activity for the tab (to be reused)
		intent = new Intent().setClass(this, DownloadMapsLocalPartUI.class);

		// Initialize a TabSpec for each tab and add it to the TabHost
		spec = tabHost.newTabSpec("local").setIndicator(res.getString(R.string.downloadmaps_localmaps),
				res.getDrawable(R.drawable.download_maps_tab_local))
				.setContent(intent);
		tabHost.addTab(spec);


		intent = new Intent().setClass(this, DownloadMapsDistPartUI.class);
		spec = tabHost.newTabSpec("dist").setIndicator(res.getString(R.string.downloadmaps_distmaps),
				res.getDrawable(R.drawable.download_maps_tab_dist))
				.setContent(intent);
		tabHost.addTab(spec);

		if(this.getIntent().getExtras() != null) {
			int default_tag = this.getIntent().getExtras().getInt("default_tag");
			if(default_tag > 0 && default_tag < 2) {
				tabHost.setCurrentTab(default_tag);
			}


			String message = this.getIntent().getExtras().getString("message");
			if(message != null) {
				if(message.equals("downloadFirstMessage")){
					Toast.makeText(this, res.getString(R.string.downloadmaps_downloadbefore), Toast.LENGTH_LONG).show();
				}
				
				int default_resort = this.getIntent().getExtras().getInt("default_resort");
				if(default_resort > 0) {
					
				}
			}
		}

	}
}
